package chaoyue.study.feature.time;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

public class LocalDateTimeTest {
    public static void main(String[] args) {
        LocalDateTime now = LocalDateTime.now();
        System.out.println(now);
        System.out.println(now.getYear());
        System.out.println(now.getMonthValue());
        System.out.println(now.getDayOfMonth());
        System.out.println(now.getHour());
        System.out.println(now.getMinute());
        System.out.println(now.getSecond());
        System.out.println(now.getDayOfWeek());

        // 构建时间
        LocalDateTime time1 = LocalDateTime.now();
        LocalDateTime time2 = time1.withHour(8).withMinute(30).withSecond(23);
        System.out.println(time1);
        System.out.println(time2);

        System.out.println(LocalDateTime.of(LocalDate.now(), LocalTime.MIN));
    }
}
